<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->

<head>
<meta charset="utf-8">
<title>SMM撮合系统</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="" name="description">
<meta content="" name="author">
<link href="${request.getContextPath()}/Public/assets/admin/css/css.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css">

<link href="${request.getContextPath()}/Public/assets/global/css/components-rounded.css" id="style_components" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/css/plugins.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/admin/css/layout.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/admin/css/themes/default.css" rel="stylesheet" type="text/css" id="style_color">
<link href="${request.getContextPath()}/Public/assets/admin/css/custom.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css">

<link href="${request.getContextPath()}/Public/assets/admin/css/common.css" rel="stylesheet" type="text/css">

<link rel="shortcut icon" href="${request.getContextPath()}/Public/favicon.ico">
<script>BASE_URL = '${request.getContextPath()}'</script>
<link href="${request.getContextPath()}/Public/css/customerDetail.css" rel="stylesheet" type="text/css">
<style>
	input{
		width:190px;
	}
</style>
</head>

<body class="page-header-top-fixed">
<!--头部信息结束 -->
<div class="page-header">
	<!--头部开始-->
	<#include "/include/top.html" />
	<!-- 头部信息结束 -->


	<!-- 头部菜单开始 -->
	<#include "/include/top_menu.html" />
	<!-- 头部菜单结束 -->
</div>
<!-- END HEADER -->


<!-- BEGIN PAGE CONTAINER -->
<div class="page-container">
	
	<!-- 内容开始 -->
	<div class="page-content">
		<div class="container-fluid">
			<div class="row margin-top-10">
			<div class="portlet light">
				<div class="portlet-body">
					<form method="post" id="frm1" name="frm1">
						<div class="row">
							<h1>
								<#if (contacter.id)?exists>
									编辑联系人
								<#else>
									添加联系人
								</#if>
							</h1>
							<input type="hidden" id= "id" name="id" value="${(contacter.id)!''}" />
							<input type="hidden" id= "companyId" name="companyId" value="${(contacter.companyId)!''}" />
							<input type="hidden" id="tidentity" name="tidentity" value="${(contacter.tidentity)!''}" />
							<table class="tb" cellspacing="1" border="1">
								<tr>
									<td class="tdTitle">姓名*</td>
									<td class="tdContent"><input type="text" name ="name" value="${(contacter.name)!''}"></td>
									<td class="tdTitle">性别*</td>
									<td class="tdContent">
										<#if contacter?exists && contacter.sex==1>
											<label><input type="radio" name="sex" value="0" />先生&nbsp;</label>
											<label><input type="radio" name="sex" value="1" checked/>女士</label>
										<#else>
											<label><input type="radio" name="sex" value="0" checked />先生&nbsp;</label>
											<label><input type="radio" name="sex" value="1" />女士</label>
										</#if>
									</td>
								</tr>
								<tr>
									<td class="tdTitle">职位*</td>
									<td class="tdContent"><input type="text" name ="position" value="${(contacter.position)!''}" ></td>
									<td class="tdTitle">手机*</td>
									<td class="tdContent"><input type="text" name ="mobilePhone" value="${(contacter.mobilePhone)!''}" ></td>
								</tr>
								<tr>
									<td class="tdTitle">QQ</td>
									<td class="tdContent"><input type="text" name ="qq" value="${(contacter.qq)!''}" ></td>
									<td class="tdTitle">固话</td>
									<td class="tdContent"><input type="text" name ="telephone" value="${(contacter.telephone)!''}" ></td>
								</tr>
								<tr>
									<td class="tdTitle">邮箱</td>
									<td class="tdContent"><input type="text" name ="email" value="${(contacter.email)!''}" ></td>
									<td class="tdTitle">交易身份*</td>
									<td class="tdContent" id="identityType">
										<#if contacter?exists>
											<#if contacter.tidentity == 0>
												<label><input type="checkbox" value="0" checked />采购</label>
												<label><input type="checkbox" value="1" />销售</label>
											<#elseif contacter.tidentity == 1>
												<label><input type="checkbox" value="0" />采购</label>
												<label><input type="checkbox" value="1" checked />销售</label>
											<#elseif contacter.tidentity == 2>
												<label><input type="checkbox" value="0" checked />采购</label>
												<label><input type="checkbox" value="1" checked />销售</label>
											</#if>
										<#else>
											<label><input type="checkbox" value="0" />采购</label>
											<label><input type="checkbox" value="1" />销售</label>
										</#if> 
									</td>
								</tr>
							</table>
							<div style="margin:0 auto; width:400px;">
								<div style="margin: 20px 0;">所属企业*&nbsp;&nbsp;<input type="text" ></div>
								<button class="btn green" id="ctSave" >保存</button>&nbsp;
								<button class="btn green" id="ctSaveAndNew" >保存并新建</button>&nbsp;
								<button class="btn green" id="reBack" >返回</button>
								<label><input type="checkbox" />同时更新商城</label>
							</div>
						</div>
					</form>
				</div>
			</div>
			</div>
		</div>
	</div>
</div>


<!-- END PAGE CONTAINER -->


<!-- 底部开始 -->
<#include "/include/foot.html" />
<!-- 底部结束 -->

<!--[if lt IE 9]>
<script src="${request.getContextPath()}/Public/assets/global/plugins/respond.min.js"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>

<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.sparkline.min.js" type="text/javascript"></script>

<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript"></script>

<script src="${request.getContextPath()}/Public/assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/admin/scripts/layout.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/admin/scripts/indexComponent.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/admin/scripts/commonUtils.js" type="text/javascript"></script>

<script>
	
	jQuery(document).ready(function() {
	   
	   Metronic.init(); // init metronic core componets
	   Layout.init(); // init layout
	   IndexComponent.init(); // init index component
	});
	recordDate();
	//初始化日期
	function recordDate() {
		var nowDate = new Date();
        //$('#date-picker').attr("date-date",nowDate.getFullYear()+"/"+parseInt(nowDate.getMonth()+1)+"/"+nowDate.getDate());
        $('.date-picker').datepicker({
    	    autoclose: true	   
    	});
	}
	
	
	$(function(){
		$("#identityType :checkbox").each(function(index, element){
			$(element).click(function(){
				var count = 0;
				$("#identityType :checkbox").each(function(index, element){
					if($(element).attr("checked")){
						count++;
					}
				});
				$("#tidentity").val(count);
			});
		});
		
		$("#ctSave").click(function(){
			//添加
			if($("#id").val() == ""){
				debugger;
				if("${companyId!''}" != ""){
					$("#companyId").val("${companyId!''}");
				}
				$("#frm1").attr("action", "addContacterForCompany.do");
				$("#frm1").submit();
			}
			//更新
			else {
				$("#frm1").attr("action", "updateContacter.do");
				$("#frm1").submit();
			}
		});
		
		$("#ctSaveAndNew").click(function(){
			//添加
			if($("#id").val() == ""){
				debugger;
				if("${companyId!''}" != ""){
					$("#companyId").val("${companyId!''}");
				}
				$("#frm1").attr("action", "addContacterForCompanyAndShowAddView.do");
				$("#frm1").submit();
			}
			//更新
			else {
				$("#frm1").attr("action", "updateContacterAndShowAddView.do");
				$("#frm1").submit();
			}
			
		});
	});
	function reBack(){
		document.location.href = -1;
	}
	
</script>
</body>
</html>